import { Component, OnInit } from '@angular/core';
import {ActivatedRoute} from '@angular/router';

@Component({
  selector: 'app-newscontent',
  templateUrl: './newscontent.component.html',
  styleUrls: ['./newscontent.component.scss']
})
export class NewscontentComponent implements OnInit {

  constructor(public route:ActivatedRoute) { }

  ngOnInit(): void {
    console.log(this.route.queryParams);

    this.route.queryParams.subscribe((data)=>{
        console.log("get方式获取传值"+data.newId);
    })


        this.route.params.subscribe((data)=>{
              console.log("动态路由获取传值"+data.newId)
        })
  }

}
